import React from 'react';
import Loadable from 'react-loadable';
import {HashRouter as Router ,Switch,Route} from 'react-router-dom'

function loading():any{
  return (
    <div>
      加载中...
    </div>
  )
}
// 首屏优化，打包优化
const Home  = Loadable(
  {
    loader:()=>import('./pages/home'),
    loading:loading
  }
)
const Text  = Loadable(
  {
    loader:()=>import('./pages/text'),
    loading:loading
  }
)

export default class RouterManage extends React.Component{
  render() {
    return (
      <Router>
        <Switch>
          <Route exact path="/" component={Home}></Route>
          <Route exact path="/text" component={Text}></Route>
        </Switch>
      </Router>
    );
  }
}